import request from '@/utils/request'

const employee = {
  getEmployeeListAPI: function (params) {
    return request({
      url: '/sys/employee/list',
      method: 'post',
      data: params || {}
    })
  },
  getEmployeeAPI: function (params) {
    return request({
      url: '/sys/employee/detail/' + params.employeeCode,
      method: 'get'
    })
  },
  getEmployeePositionAPI: function (params) {
    return request({
      url: '/sys/employee/position/' + params.employeeCode,
      method: 'get'
    })
  },
  getEmployeeSelfAPI: function (params) {
    return request({
      url: '/sys/employee/update/self',
      method: 'put',
      data: params
    })
  },
  addEmployeeAPI: function (params) {
    return request({
      url: '/sys/employee/add',
      method: 'post',
      data: params
    })
  },
  updateEmployeeAPI: function (params) {
    return request({
      url: '/sys/employee/update/' + params.employeeCode,
      method: 'put',
      data: params
    })
  },
  saveOrUpdateEmployeeAPI: function (params) {
    return request({
      url: '/sys/employee/position/save/' + params.employeeCode,
      method: 'put',
      data: params
    })
  },
  deleteEmployeeAPI: function (params) {
    return request({
      url: '/sys/employee/delete/' + params.employeeCode,
      method: 'delete'
    })
  },
  statisticsEmployeeCountAPI: function () {
    return request({
      url: '/sys/employee/statistics/count',
      method: 'get'
    })
  },
  addEmployeePositonAPI: function (params) {
    return request({
      url: '/sys/employee/position/add',
      method: 'post',
      data: params
    })
  },
  deleteEmployeePositonAPI: function (params) {
    return request({
      url: '/sys/employee/position/delete/' + params.employeeCode + '/' + params.positionCode,
      method: 'delete'
    })
  }
}

export default employee
